﻿@model System.Dto.HouseHoldList
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layuimini-v2/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuimini-v2/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
    <div class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">住户名</label>
            <div class="layui-input-block">
                <input type="text" name="UserName" lay-verify="required" lay-reqtext="住户名不能为空" placeholder="请输入住户名" value="@Model.UserName" class="layui-input">
                <tip>填写自己管理账号的名称。</tip>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required">密码</label>
            <div class="layui-input-block">
                <input type="text" name="PassWord" placeholder="请输入密码" value="@Model.PassWord" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label required">邮箱</label>
            <div class="layui-input-block">
                <input type="text" name="Email" placeholder="请输入邮箱" value="@Model.Email" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required">电话</label>
            <div class="layui-input-block">
                <input type="text" name="Iphone" placeholder="请输入邮箱" value="@Model.PhoneNumber" class="layui-input">
            </div>
        </div>

        @*<div class="layui-form-item">
            <label class="layui-form-label required">是否房主</label>
            <div class="layui-input-block">
                @{ if (Model.IsOwner == "否")
                    {
                        <input type="radio" name="IsOwner" value="0" title="否" checked="">
                    }
                    else
                    {
                        <input type="radio" name="IsOwner" value="0" title="否">
                    }
                }
                @{ if (Model.IsOwner == "是")
                    {
                        <input type="radio" name="IsOwner" value="1" title="是" checked="">
                    }
                    else
                    {
                        <input type="radio" name="IsOwner" value="1" title="是">
                    }
                }

            </div>
        </div>*@

        <div class="layui-form-item">
            <label class="layui-form-label required">性别</label>
            <div class="layui-input-block">
                @{ if (Model.Sex == "女")
                    {
                        <input type="radio" name="Sex" value="0" title="女" checked="">
                    }
                    else
                    {
                        <input type="radio" name="Sex" value="0" title="女">
                    }
                }
                @{ if (Model.Sex == "男")
                    {
                        <input type="radio" name="Sex" value="1" title="男" checked="">
                    }
                    else
                    {
                        <input type="radio" name="Sex" value="1" title="男">
                    }
                }

            </div>
        </div>

        @*<div class="layui-form-item">
                <label class="layui-form-label">房间号</label>
                <div class="layui-input-block">
                    <input type="text" name="StoreyId" placeholder="选择房间号" autocomplete="off" class="layui-input" id="demo2" value="@Model.StoreyTitle">
                </div>
            </div>*@

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注信息</label>
            <div class="layui-input-block">
                <textarea name="Remark" class="layui-textarea" placeholder="请输入备注信息" value="@Model.Remark"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </div>

    <script src="/layuimini-v2/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script src="/layuimini-v2/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
    <script>
        layui.use(['form', 'tableSelect', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            tableSelect = layui.tableSelect,
            $ = layui.$;




        //监听提交
            form.on('submit(saveBtn)', function (data) {
                var data = data.field;
            var index = layer.alert("确定修改吗？", {
                title: '确认信息'
            }, function () {

                $.ajax({
					url: "@Url.Action("EditMyHousehold")",
                    type: "post",
                    data: { "Id": @Model.Id, "UserName": data.UserName, "PassWord": data.PassWord, "Email": data.Email, "PhoneNumber": data.Iphone, "Sex": data.Sex, "Remark": data.Remark },
					success: function (da) {
						console.log(da)
						layer.msg(da.msg)

					},
				})

                // 关闭弹出层
                layer.close(index);

                var iframeIndex = parent.layer.getFrameIndex(window.name);
                parent.location.reload();
                parent.layer.close(iframeIndex);

            });

            return false;
        });

    });
    </script>
</body>
</html>